/*
 * @Author: xjc
 * @Date: 2022-03-30 17:11:45
 * @LastEditTime: 2022-03-30 17:13:57
 * @LastEditors: xjc
 * @Description: webpack基本配置
 */
const path = require('path');
const nodeExcternals = require('webpack-node-externals');
const cleanWebpackPlugin = require('clean-webpack-plugin');

module.exports = {
  target: 'node',
  mode: 'development',
  entry: path.join(__dirname, 'app', 'index'),
  output: {
    path: path.join(__dirname, 'dist'),
    filename: "bundle.js"
  },
  module: {
    rules: [{
      test: /\.js$/,
      use: {
        loader: 'babel-loader',
      },
      exclude: [path.join(__dirname, '/node_modules')],
    }, ]
  },
  resolve: {
    extensions: ['.json', '.js', '.jsx'],
    alias: {
      '@': path.resolve(__dirname, 'app')
    }
  },
  externals: [nodeExcternals()],
  plugins: [
    new cleanWebpackPlugin()
  ]
};